<#assign contextPath=springMacroRequestContext.getContextPath() />
<#import "/public/frame/main.html" as frame />
<@frame.head "南航明珠商城-广告管理">
</@frame.head>
<style>
/*缩略图div*/
.div_show{float:left;background-color: #cccccc; width: 200px;height: 200px;display: inline-block; position: relative;}
.div_show img{ width: 200px;height: 200px;}
.div_show .delete{position: absolute;top: 10px; right: 0px;width: 40px; height: 40px;font-size: 36px;display:none;color:red;}
</style>
<script type="text/javascript" src="${contextPath}/resources/js/tool/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/comm.js"></script>

<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 后台管理中心 <span class="c-gray en">&gt;</span> 促销管理 <span class="c-gray en">&gt;</span> 广告管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
<form action="${contextPath}/promotion/<#if isUpdate>update_promotion<#else>save_promotion</#if>" method="post" enctype="multipart/form-data" id="save_form" target="hidden_frame">
	<input type="hidden" value="${promotion.id}" id="promotionId" name="promotionId"/> 
	<table class="table">
		<tr>
		   <td width="80px">版块名：</td>  
		   <td width="300px">				    
           <span class="select-box radius">
           <select class="select" id="type"  name="type" onchange="changeType()" <#if promotion.type??> disabled="disabled"</#if> >
           <option value="0">--请选择版块名--</option>
           <#list typeMap?keys as key>
                  <option value="${key}" <#if key==promotion.type>selected="selected"</#if>>${typeMap["${key}"]}</option> 
           </#list>
           </select>
           </span>
		   </td> 
		   <td></td>
		</tr>
		<tr id="adType" style="display: none;">
		   <td>广告类型：</td>
		   <td>
		      <#list adTypeMap?keys as key>
		      <#if key==1>
		          <input type="radio" name="adType" value="${key}" onchange="changeAdType();" <#if 1==promotion.adType>checked</#if>/>${adTypeMap["${key}"]}
		      <#else>
		          <input type="radio" name="adType" value="${key}" onchange="changeAdType();" <#if 2==promotion.adType>checked</#if>/>${adTypeMap["${key}"]}
		      </#if>
		      </#list>
		   </td> 
		   <td></td>
		</tr>
		<tr>
			<td>广告主题：</td>
			<td>
			<input type="text" class="input-text  radius"  id="title" name="title" value="${promotion.title}" placeholder="请输入广告主题" maxlength="100">
			</td>
		   <td></td>
		</tr>
		<tr id="advertImage">
			<td>图   片：</td>
			<td>
			 <div  id="showPicture" class="div_show">
			   <#if promotion.image??>
	           <img id="images" src="${imagePath}/activity/${promotion.id}/${promotion.image}" data-type="1"/>
	           <#else>
	           <img id="images"/>
	           </#if>
	           <a href="javascript:;">
                 <div class="delete icon Hui-iconfont Hui-iconfont-del3"  data-id="upload" ></div>
               </a>
	         </div> 
               <input type="file"  id="upload" name="images" class="addImage" data-id="showPicture">
			</td>
		   <td></td>
		</tr>
			<tr id="imageDescription" style="display:none;">
			<td></td>
			<td id="description" colspan="2">建议上传1920*400尺寸，jpg、gif、png或者bmp格式，单张图片大小不超过2MB</td>
		</tr>
		<tr id="positionTr">
			<td>顺序：</td>  
			<td>		    
           <span class="select-box radius">
           <select class="select" id="position" name="position">
           <option  value="0">--请选择顺序--</option>
           <#list positionMap?keys as key>
                  <option value="${key}" <#if key==promotion.position>selected="selected"</#if> >${positionMap["${key}"]}</option> 
           </#list>
           </select>
           </span>
		    </td> 
		   <td></td>
		</tr>
		<tr id="highlight" style="display: none;">
			<td>广告主题突出显示：</td>
			<td><input type="checkbox" name="highlight" value="1" <#if 1==promotion.highlight>checked</#if>/></td>
		   <td></td>
		</tr>
		<tr id="adLink">
			<td>广告链接：</td>
			<td>
			<input type="text" class="input-text  radius" value="${promotion.url}" placeholder="请输入广告链接" id="url" name="url">
			</td>
		   <td></td>
		</tr>
		<tr id="adDetail" style="display: none;">
			<td>广告详情：</td>
			<td colspan="2">
			<textarea cols="80" id="adDetailContent" name="adDetail">${promotion.content}</textarea> 
			<script type="text/javascript">
				CKEDITOR.replace('adDetailContent',{filebrowserUploadUrl :'${contextPath}/ckeditor/uploader?Type=File&uploadModel=advert',filebrowserImageUploadUrl : '${contextPath}/ckeditor/uploader?Type=Image&uploadModel=advert',filebrowserFlashUploadUrl : '${contextPath}/ckeditor/uploader?Type=Flash&uploadModel=advert'});
			</script>
			</td>
		</tr>
		<tr height="10px"><td></td><td></td></tr>
	    <tr align="center">
			<td><input type="button"  class="btn btn-success radius"  value="确定" onclick="return checkForm()"/></td>
			<td><input type="button"  class="btn btn-secondary radius"  value="取消" onclick="cancle();"/></td>
		</tr>
   </table>
</form>
</div>
<iframe name="hidden_frame" style="display:none;"></iframe>	
<@frame.end "default">
</@frame.end>
<script type="text/javascript" src="${contextPath}/resources/js/promotion/promotion_add_or_update.js"></script>
 <script type="text/javascript">
var path="${contextPath}";
</script>